Problem Note 36998: An SQLPLAN error might occur when you submit an SQL procedure and you use a new name for a variable in a subquery
An SQLPLAN error might occur when you run a PROC SQL query similar to the following:
proc sql;
create table test as
select RA_LOC_OUT_SEQ_NO as Loc_Seq,
(select count(CT2OK)
from ds1
where Loc_Seq=RA_LOC_OUT_SEQ_NO
) as noswipe
from ds1;
quit;
The error that occurs is similar to the following:
ERROR: sqlplan internal error: Cannot find symbol Loc_Seq,
var=1, tag=0002.
The error occurs when you give a variable a new name in a query and then you use that new name within a subquery that also has an alias.
To circumvent this problem, use the original variable name in the subquery rather than the new name.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows Server 2008 | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Windows Vista | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
HP-UX IPF | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Linux | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Linux on Itanium | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
OpenVMS Alpha | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Solaris for x64 | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
Tru64 UNIX | 9.1 TS1M3 SP4 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
data ds1;
ra_loc_out_Seq_no=1;
ct2ok='N';
ra_profile_no='a';
PROC SQL;
CREATE TABLE test AS
SELECT RA_LOC_OUT_SEQ_NO as Loc_Seq,
(SELECT count(CT2OK)
FROM ds1
where Loc_Seq = RA_LOC_OUT_SEQ_NO
) as noswipe
FROM ds1;
QUIT;
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> SQL
|
Date Modified: | 2009-09-08 14:11:49 |
Date Created: | 2009-08-26 14:20:51 |